define(
	[
		'require',
		'apm/ui/business_rank',
		'apm/ui/business_time_ranges',
		'apm/ui/business_chart_line'
	],
	function(require){
		var forEach = Ember.EnumerableUtils.forEach;

		var View = Ember.View.extend({
			RankChart: require("apm/ui/business_rank"),

			LineChartView: require('apm/ui/business_chart_line').extend({
				init: function(){
					this.dataKeyChange();
					this._super();
				},

				dataKeyChange: Ember.observer("dataKey", function(){
					switch(this.get("dataKey")){
						case "system/response_time/avg":
							this.set("title", "系统平均响应时间24小时分布图");
							this.set("sName","系统平均响应时间");
							this.set("fmtType", "transform_time_ms");
							break;
						case "business/response_time/avg":
							this.set("title", "交易平均响应时间24小时分布图");
							this.set("sName","交易平均响应时间");
							this.set("fmtType", "transform_time_ms");
							break;
						case "system/score/apdex":
							this.set("title", "Apdex24小时分布图");
							this.set("sName","Apdex");
							this.set("fmtType", undefined);
							break;
						case "business/score/apdex":
							this.set("title", "Apdex24小时分布图");
							this.set("sName","Apdex");
							this.set("fmtType", undefined);
							break;
						case "system/success/rate":
							this.set("title", "系统成功率24小时分布图");
							this.set("sName","系统成功率");
							this.set("fmtType", undefined);
							break;
						case "business/success/rate":
							this.set("title", "交易成功率24小时分布图");
							this.set("sName","交易成功率");
							this.set("fmtType", undefined);
							break;
						// case "network/bytes/total":
						// 	this.set("title", "流量分布图");
						// 	this.set("sName","流量");
						// 	this.set("fmtType", "transform_flow_mb");
						// 	break;
						case "system/error/count":
							this.set("title", "系统错误数24小时分布图");
							this.set("sName","系统错误数");
							this.set("fmtType", undefined);
							break;
						case "business/error/count":
							this.set("title", "交易错误数24小时分布图");
							this.set("sName","交易错误数");
							this.set("fmtType", undefined);
							break;
						case "system/user/unique":
							this.set("title", "并发用户数24小时分布图");
							this.set("sName","并发用户数");
							this.set("fmtType", undefined);
							break;
						case "system/throughput/total":
							this.set("title", "吞吐量24小时分布图");
							this.set("sName","吞吐量");
							this.set("fmtType", undefined);
							break;
						case "business/throughput/total":
							this.set("title", "交易量24小时分布图");
							this.set("sName","交易量");
							this.set("fmtType", undefined);
							break;
					}
				}),

				_translateSeries: function(option){
					this._super(option);

					option.series[0].symbol = 'circle';
					option.series[0].symbolSize = 1;
					option.series[0].showAllSymbol = true;
				}
			}),

			TimeRanges: require('apm/ui/business_time_ranges'),

			didInsertElement:function(){
				var view = Broada.getView("timeRangeSelect");
				var content = Ember.A([
						{
							name: "前1小时",
							value: "1h"
						},
						{
							name: "前1天",
							value: "1d"
						},
						{
							name: "前1周",
							value: "7d"
						},
						{
							name: "前1个月",
							value: "1M"
						}
					]);
				view.set("content",content);
				var timeRangeView = Broada.getView("businessTimeRangesTopo");
				timeRangeView.$().hide();
			}
		});

		APM.BusinessDetailExperiencePageView = View;

		return View;
	}
);